<template>
  <div class="home_box">
    <!--下拉刷新-->
    <van-pull-refresh v-model="loading" @refresh="onRefresh">
      <!--搜索区-->
      <HomeSearch />
      <!--轮播区-->
      <HomeCarousel />
      <!--公告区-->
      <HomeNotice />
      <!--分栏区-->
      <HomeGrid />
      <!--推荐区-->
      <HomeRecommend />
    </van-pull-refresh>
  </div>
</template>

<script>
import HomeCarousel from "./component/HomeCarousel";
import HomeSearch from "./component/HomeSearch";
import { ref } from "vue";
import { Toast } from "vant";
import HomeNotice from "./component/HomeNotice";
import HomeGrid from "./component/HomeGrid";
import HomeRecommend from "./component/HomeRecommend";
export default {
  name: "index",
  components: { HomeRecommend, HomeGrid, HomeNotice, HomeSearch, HomeCarousel },
  setup() {
    const loading = ref(false);
    const onRefresh = () => {
      setTimeout(() => {
        Toast("刷新成功");
        loading.value = false;
      }, 1000);
    };
    return { loading, onRefresh };
  },
};
</script>

<style scoped>
.home_box {
  padding-bottom: 4rem;
}
</style>
